package dimensional.traveler.shared.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

import dimensional.traveler.shared.model.missionSequence.MissionSequence;

public class Mission extends Describable implements Serializable {

	private static final long serialVersionUID = 3051127310425420967L;

	private List<MissionSequence> missionSequences = new ArrayList<MissionSequence>();
	private int currentMissionSequenceIndex = 0;

	private String missionId;
	private boolean havingVictoryImage;
	private boolean havingDefeatImage;
	private boolean victorious;
	private Universe era;

	private Collection<Shop> shops = new LinkedList<Shop>();
	private Collection<Trainer> trainers = new LinkedList<Trainer>();

	/**
	 * For serialization.
	 */
	private Mission() {
	}

	public Mission(String missionId) {
		this();
		this.missionId = missionId;
	}

	public String getMissionId() {
		return missionId;
	}

	public boolean isHavingVictoryImage() {
		return havingVictoryImage;
	}

	public void setHavingVictoryImage(boolean havingVictoryImage) {
		this.havingVictoryImage = havingVictoryImage;
	}

	public boolean isHavingDefeatImage() {
		return havingDefeatImage;
	}

	public void setHavingDefeatImage(boolean havingDefeatImage) {
		this.havingDefeatImage = havingDefeatImage;
	}

	public boolean isVictorious() {
		return victorious;
	}

	public void setVictorious(boolean victorious) {
		this.victorious = victorious;
	}

	public Universe getEra() {
		return era;
	}

	public void setUniverse(Universe era) {
		this.era = era;
	}

	public void addMissionSequence(MissionSequence missionSequence) {
		missionSequences.add(missionSequence);
	}

	public MissionSequence getNextMissionSequence() {
		return missionSequences.get(currentMissionSequenceIndex++);
	}

	public Collection<Shop> getNewlyAvailableShops() {
		return this.shops;
	}

	public void addShop(Shop shop) {
		shops.add(shop);
	}

	public void addTrainer(Trainer trainer) {
		trainers.add(trainer);
	}

	public Collection<Trainer> getNewlyAvailableTrainers() {
		return this.trainers;
	}
}